<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../Ajs/vue.min.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .active{
            border:1px solid blue;
            width:100px;
            height:100px;
        }

        .error{
            background-color:red;
        }
        .test{
            color:pink;
        }
        .base{
            font-size: 20px;
        }

        .blue{
            color: blue;
        }
    </style>
</head>
<body>
<div id="app">
    <div :class="{active:isActive}">123</div>

    <div :class="[activeClass,errorClass]">123</div>
    <div :class="arrClass">123</div>
    <div :class="objClass">123</div>

    <div :class="[activeClass,errorClass,{test:isTest}]">123</div>

    <div class="base" :class="activeClass">123</div>

    <div :class="['error',isBlue=='123'?'blue':'']">123</div>
</div>

<script>
    var vm = new Vue({
        el:"#app",
        data:{
            isActive:true,
            isTest:true,
            isBlue:'123',

            activeClass:"active",
            errorClass:"error",
            arrClass:['active','error'],
            objClass: {
                active: true,
                error: true
            }
        },
        methods:{}
    })

    // 【样式class绑定】
    /*
    style
        .active{
            border:1px solid blue;
            width:100px;
            height:100px;
        }

    方式一：
    <div :class="{active:isActive}"></div>
    data:{
        isActive:true
    }

    方式二：
    <div :class="[activeClass,errorClass]"></div>
    data:{
        activeClass:"active",
        errorClass:"error"
    }


    样式绑定相关语法细节：
    1.对象绑定和数组绑定可以结合使用
        <div :class="[activeClass,errorClass,{test:isTest}]"></div>

    2.class绑定的值可以简化操作
        arrClass:['active','error'],
        objClass:{
            active:true,
            error:true
        }

    3.默认的class如何处理？  默认的class会保留
        <div class="base" :class="activeClass">123</div>

    * */





</script>
</body>
</html>
